// 

const path = require('path');

let pathname = 'path1.js';
console.log(path.isAbsolute(pathname)); // false

pathname = __filename;
console.log(path.isAbsolute(pathname)); // true

let name = path.basename(pathname); // 取文件名称
console.log(name);

let dir = path.dirname(pathname); // 取目录名称
console.log(dir);
pathname = path.join('d:', 'Mycode;', 'web-java-script;', 'nodejs', 'path', 'hello.txt');
console.log(pathname);

console.log(path.delimiter);
//将pathname 以 ' ; ' 为分割符分割成子字符串数组，以指定的分割字串来决定每个拆分的位置。 
console.log(pathname.split(path.delimiter));